﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AggregateRoot.Console
{
    class AggregateRootWithParentOperation
    {
        
        #region Update Order - CRUD Parent tables

        //CRUD Parent Data

        public static void Update_Order_Add_Parent_Customer_Data()
        {
            OrderRepository orderRep = new OrderRepository();
            Order order = orderRep.GetByOrderId(11078);

            Customer C = new Customer();
            C.CustomerID = "xx202";
            C.CompanyName = "yy202";

            order.Customer = C;

            orderRep.Save();
        }

        public static void Update_Order_Update_Parent_Customer_Data()
        {
            OrderRepository orderRep = new OrderRepository();
            Order order = orderRep.GetByOrderId(11078);
            order.Customer.CompanyName = "abc inc";

            orderRep.Save();
        }

        //can't be done with out repository of parent table??
        public static void Update_Order_Delete_Parent_Customer_Data()
        {

        }

        #endregion

    }
}
